<template>
	<view class="content" v-html="content">
		
	</view>
</template>

<script>
	import api from '@/http/api/index.js'
	export default {
		data() {
			return {
				content:'',
			}
		},
		onLoad(option) {
			console.log(option,'index')
			if(option.n) {
				this.getListByChannelNo(option.n)
			}else{
				uni.reLaunch({ url:'/pages/page404/page404' })
			}
		},
		methods: {
			getListByChannelNo(channelNo) {
				uni.showLoading({ title: '加载中...',mask:true });
				api._getListByChannelNo(channelNo)
					.then(res => {
						console.log(res);
						uni.hideLoading();
						if(res.data.success && res.data.data.total > 0) {
							let item = res.data.data.rows[0];
							this.content = item.content;
							uni.setNavigationBarTitle({ title: item.pageTitle });
						}else{
							uni.clearStorageSync();
							uni.reLaunch({ url:'/pages/page404/page404' })
						}
					})
					.catch(err => {
						console.log(err);
						uni.hideLoading();
						uni.showToast({ title: 'error,网络异常请重试！', icon:"none", duration: 2000 });
					})
			}
		}
	}
</script>

<style>
	.content {
		padding: 30upx;
		max-width: 2400upx;
		height: auto;
		margin: auto;
	}
</style>
